package kz.edu.sdu.atm.models;

public class Response {
	public static Response AUTH_FAIL;
	public static Response REQUEST_FAIL;
	public static Response OK;

	static {
		AUTH_FAIL = new Response();
		AUTH_FAIL.setStatus(ResponseStatus.AUTH);
		AUTH_FAIL.setMessage("No such user or password");

		REQUEST_FAIL = new Response();
		REQUEST_FAIL.setStatus(ResponseStatus.FAIL);
		REQUEST_FAIL.setMessage("Request fail");

		OK = new Response();
		OK.setStatus(ResponseStatus.OK);
		OK.setMessage("OK");
	}

	private ResponseStatus status;
	private String message;

	public Response() {

	}

	public Response(ResponseStatus s) {
		status = s;
	}

	public Response(ResponseStatus s, String msg) {
		status = s;
		message = msg;
	}

	public ResponseStatus getStatus() {
		return status;
	}

	public void setStatus(ResponseStatus status) {
		this.status = status;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public void set(ResponseStatus s, String m) {
		status = s;
		message = m;
	}

	@Override
	public String toString() {
		return String.format("%s: [%s]", getStatus().toString(), getMessage());
	}

}
